#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "mymodel.h"
#include "qtableview.h"
#include "QtWidgets/QHBoxLayout"
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    _layout(new QHBoxLayout(this))
{
    ui->setupUi(this);

    ui->centralWidget->setLayout(_layout);

    QTableView * view = new QTableView(this);
    MyModel *model = new MyModel(view);
    view->setModel(model);
    view->horizontalHeader()->setStretchLastSection(true);
    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    _layout->addWidget(view);

}

MainWindow::~MainWindow()
{
    delete ui;
}
